import mysql.connector
import json

# 连接到MySQL数据库
conn = mysql.connector.connect(user='root', password='Surpriselee#1394', host='172.16.41.101', database='bankwings-credit')
cursor = conn.cursor()

# 读取JSON文件
with open('c:/Tmp/data.json', 'r', encoding='UTF-8') as file:
    data = json.load(file)

# 假设data是一个列表，每个元素是一个字典或JSON对象
for item in data:
    query = "INSERT INTO common_mapping_product_model (code,value) VALUES (%s,%s)"
    cursor.execute(query, (item['code'], item['value']))

conn.commit()
cursor.close()
conn.close()